#include <stdio.h>
#include <limits.h>

#define N 5

int main(void) {
	int array[N][N] = { 0 }, total_student[N] = { 0 };
	int max_course[N] = { INT_MIN, INT_MIN, INT_MIN, INT_MIN, INT_MIN };
	int min_course[N] = { INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX };
	int grade;
	float average_student[N] = { 0.0f }, average_course[N];

	for (int i = 0; i < N; i++)
	{
		printf("Enter grades of student %d: ", i + 1);
		for (int j = 0; j < N; j++)
		{
			scanf("%d", &array[i][j]);
		}
	}

	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			grade = array[i][j];

			total_student[i] += grade;
			average_course[j] += (float)grade / N;

			if (max_course[j] < grade)
			{
				max_course[j] = grade;
			}

			if (min_course[j] > grade)
			{
				min_course[j] = grade;
			}
		}
		average_student[i] = (float)total_student[i] / N;
	}

	// 打印中文需要将文件编码改为UTF-8
	for (int i = 0; i < N; i++)
	{
		printf("学生 %d 的总分为 %d ，平均分为 %.2f。\n", i, total_student[i], average_student[i]);
	}

	printf("\n");
	for (int i = 0; i < N; i++)
	{
		printf("课程 %d 的平均分为 %.2f，最高分为 %d，最低分为 %d。\n", i, average_course[i], max_course[i], min_course[i]);
	}
	printf("\n");
	return 0;
}